package main

import "fmt"

func main() {

	// 数组
	println("数组的声明和使用：")
	s1 := [3]int{}
	fmt.Printf("s1: %v, len: %d, cap: %d \n", s1, len(s1), cap(s1))

	//切片， 推荐， 最佳实践：make([]int, 0, cap)
	println("切片的声明和使用：")
	s2 := make([]int, 0, 3)
	fmt.Printf("s2: %v, len: %d, cap: %d \n", s2, len(s2), cap(s2))
	s2 = append(s2, 1)
	s2 = append(s2, 2)
	s2 = append(s2, 3)
	s2 = append(s2, 4)
	fmt.Printf("after scale, s2: %v, len: %d, cap: %d \n", s2, len(s2), cap(s2))
}
